home *** CD-ROM | disk | FTP | other *** search
-
- // day_view = 0, month_view = 1, week_view = 2
- var _monthview_showing = 1;
- var _open_daypopup = false;
-
- //////////////////////////////////////////////////////
- // DoOnDayMonthControllerLoaded
-
- function DoOnDayMonthControllerLoaded()
- {
- // DoOnLoadDayMonthTitle();
- // UpdateDayMonthTitleSize();
-
- // Make appropriate view visible:
- var iView;
- iView = window.top.external.GetCurrentView();
- if( iView == 1 )
- MakeMonthViewVisible();
- else if (iView == 0 )
- MakeDayViewVisible();
- else
- MakeWeekViewVisible();
-
- window.onresize = DoOnWindowResize;
- }
-
- //////////////////////////////////////////////////////
- // DoOnWindowResize
-
- function DoOnWindowResize()
- {
- if (_monthview_showing == 0) {
- //DayViewDivUpdateSize();
- }
- }
-
- //////////////////////////////////////////////////////
- // MakeMonthViewVisible
-
- function MakeMonthViewVisible()
- {
- MonthViewDiv.style.visibility = "visible";
- DayViewDiv.style.visibility = "hidden";
- WeekViewDiv.style.visibility = "hidden";
-
- // NB: This must be set *before* refreshing the
- // tab and title elements...
- _monthview_showing = 1;
- window.external.TellViewChange(1); //if I use true here, I got a -1 on the C++ side
-
- MonthViewDivRefresh();
- RefreshDayMonthTitle();
- window.focus();
- }
-
- //////////////////////////////////////////////////////
- // MakeDayViewVisible
-
- function MakeDayViewVisible()
- {
- DayViewDiv.style.visibility = "visible";
- MonthViewDiv.style.visibility = "hidden";
- WeekViewDiv.style.visibility = "hidden";
-
- // NB: This must be set *before* refreshing the
- // tab and title elements...
- _monthview_showing = 0;
- window.external.TellViewChange(0);
-
- DayViewDivRefresh();
- RefreshDayMonthTitle();
- window.focus();
- }
-
- //////////////////////////////////////////////////////
- // MakeWeekViewVisible
-
- function MakeWeekViewVisible()
- {
- WeekViewDiv.style.visibility = "visible";
- DayViewDiv.style.visibility = "hidden";
- MonthViewDiv.style.visibility = "hidden";
-
- // NB: This must be set *before* refreshing the
- // tab and title elements...
- _monthview_showing = 2;
- window.external.TellViewChange(2);
-
- WeekViewDivRefresh();
- RefreshDayMonthTitle();
- window.focus();
- }
-
- //////////////////////////////////////////////////////
- // DayMonthControllerUpdate
-
- function DayMonthControllerUpdate()
- {
- if (_monthview_showing == 1)
- MonthViewDivRefresh();
- else if (_monthview_showing == 0)
- DayViewDivRefresh();
- else
- WeekViewDivRefresh();
-
- RefreshDayMonthTitle();
- }
- //////////////////////////////////////////////////////
- // MonthViewIsVisible
-
- function MonthViewIsVisible()
- {
- if (_monthview_showing == 1)
- return true;
- else
- return false;
- }
-
- //////////////////////////////////////////////////////
- // DayViewIsVisible
-
- function DayViewIsVisible()
- {
- if (_monthview_showing == 0)
- return true;
- else
- return false;
- }
-
- //////////////////////////////////////////////////////
- // WeekViewIsVisible
-
- function WeekViewIsVisible()
- {
- if (_monthview_showing == 2)
- return true;
- else
- return false;
- }
-
- ///////////////////////////////////////////////////////
- // UpdateCurrentDate
-
- function UpdateCurrentDate(year, month, day)
- {
- window.external.SetCurrentDayMonthYear (day, month, year);
- DayViewDivRefresh();
- WeekViewDivRefresh();
- RefreshDayMonthTitle();
- }
-
-
- ///////////////////////////////////////////////////////
- // EscapeSpecialChars
- function EscapeSpecialChars(strText) // called when input data with special chars is obtained from the UI
- {
- var strReturn = strText;
- // use regular expressions for search and replace (note: the order is very important)...
- strReturn = strReturn.replace( /&/gi , "&");
- strReturn = strReturn.replace( /</gi , "<");
- strReturn = strReturn.replace( />/gi , ">");
- strReturn = strReturn.replace( /\"/gi , """);
- return strReturn;
- }
-
- ///////////////////////////////////////////////////////
- // UnescapeSpecialChars
- function UnescapeSpecialChars(strText) // called when the stored data contains escaped literals and needs to be converted to the raw chars.
- {
- var strReturn = strText;
- // use regular expressions for search and replace (note: the order is very important)...
- strReturn = strReturn.replace( /&/gi , "&");
- strReturn = strReturn.replace( /</gi , "<");
- strReturn = strReturn.replace( />/gi , ">");
- strReturn = strReturn.replace( /"/gi , "\"");
- return strReturn;
- }
-
-
- ///////////////////////////////////////////////////////
- // ShowLinkedEventDetails
-
- function ShowLinkedEventDetails(eid)
- {
-
- var d = new ActiveXObject("AolCalSvr.ACDictionary.5");
-
- d.Item("kWindow") = window;
- d.Item("kEventID") = eid;
-
- var features = "dialogWidth=421px;dialogHeight=305px;help=no;resizable=no;status=no";
- if (showModalDialog("res:IDH_ACLINKEDEVENTDLG", d, features) != 0)
- DayMonthControllerUpdate();
-
- }
-
-
- function DayViewDivRefresh()
- {
- if (bCalendarLoaded != true)
- return;
- DayViewDivUpdateSize();
- UpdateDayView();
- window.document.all.DayViewDiv.InitDLLocation ();
- }
- function UpdateDayView ()
- {
- document.all.DayViewDiv.Refresh();
- DayViewDiv.Refresh();
- }
-
- function DayViewDivUpdateSize()
- {
- }
-
- function WeekViewDivUpdateSize()
- {
- }
-
-
- var bCalendarLoaded = false;
-
- function DoOnLoadBody()
- {
- DoOnDayMonthControllerLoaded();
- window.external.CalendarLoaded();
- bCalendarLoaded = true;
- }
-
- function MonthViewDivRefresh()
- {
- if (bCalendarLoaded == true)
- MonthViewDiv.Refresh();
- }
-
- function WeekViewDivRefresh()
- {
- if (bCalendarLoaded != true)
- return;
- WeekViewDivUpdateSize();
- UpdateWeekView();
- window.document.all.WeekViewDiv.InitDLLocation ();
- }
- function UpdateWeekView ()
- {
- document.all.WeekViewDiv.Refresh();
- WeekViewDiv.Refresh();
- }
-
- /************************************************************/
- // Toolbar functions:
- /************************************************************/
-
- function RefreshDayMonthTitle()
- {
- ToolBarCtrl.RefreshDayMonthTitle();
- }
- function Refresh( iView )
- {
- if( iView == 1)
- MonthViewDiv.Refresh();
- else if (iView == 0)
- DayViewDivRefresh();
- else
- WeekViewDivRefresh();
-
- ToolBarCtrl.RefreshDayMonthTitle();
- }
-
- //////////////////////////////////////////////////////
- // Toolbar Print Button
- //This function is obsolete. java script code is replaced by C++ code.
- /*
- function DoOnClickPrint()
- {
-
- var Dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
-
- Dict.Item("kWindow") = window;
- var lReturn
- if (MonthViewIsVisible())
- {
- var features = "dialogWidth=347px;dialogHeight=250px;help=no;resizable=no;status=no";
- lReturn = showModalDialog("res:IDH_ACPRINTMONTHDLG", Dict, features);
- if (lReturn)
- window.external.PrintMonthView(Dict);
- }
- else
- {
- var features = "dialogWidth=367px;dialogHeight=250px;help=no;resizable=no;status=no";
- lReturn = showModalDialog("res:IDH_ACPRINTDAYDLG", Dict, features);
- if (lReturn)
- window.external.PrintDayView(Dict);
- }
-
- }
- */
-
- function DoOnClickPrint()
- {
- var Dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
-
- Dict.Item("kWindow") = window;
- Dict.Item("kPrinterName") = ""; //NULL to show the print dialog
- Dict.Item("kShowPrintDlg") = "true"; //This must be true always
- Dict.Item("kFromClient") = "true";
-
- var lReturn
- if (MonthViewIsVisible())
- {
- window.external.PrintMonthView(Dict);
- }
- else
- {
- window.external.PrintDayView(Dict);
- }
-
- // DoOnClickPrintEx("rams","true") ;
- }
-
- function DoOnClickPrintEx(strPrinterName,strShow)
- {
-
- var Dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
-
- Dict.Item("kWindow") = window;
- Dict.Item("kPrinterName") = strPrinterName; //NULL to show the print dialog
- Dict.Item("kShowPrintDlg") = strShow;
- Dict.Item("kFromClient") = "true"; //This must be true always
-
- var lReturn
- if (MonthViewIsVisible())
- {
- window.external.PrintMonthView(Dict);
- }
- else
- {
- window.external.PrintDayView(Dict);
- }
-
- }
-
- //////////////////////////////////////////////////////
- // Accessibility functions
-
- function DoStartLocalAccessibleCalendar()
- {
- window.external.StartLocalAccessibleCalendar(1);
- }
-
- //////////////////////////////////////////////////////
- // Toolbar Help Button
-
- function DoOnClickHelp()
- {
- window.external.AOLGoToOfflineURL ("cal_help.html");
- }
-
- //////////////////////////////////////////////////////
- // Toolbar Settings Button
-
- function DoOnClickSettings()
- {
- var dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
- dict.Item("kWindow") = window;
-
- var features = "dialogWidth=417px;dialogHeight=245px;";
- features += "help=no;resizable=no;status=no";
-
- var retVal = showModalDialog("res:IDH_ACSETTINGDIALOG", dict, features);
-
- if (retVal)
- {
- if( window.external.InternetConnectionIsOpen() )
- window.external.StartSilentSync();
- DayMonthControllerUpdate();
- }
- }
-